﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using Skynet.WebFoundation.Services.Navigation;
using Skynet.WebFoundation.Constants;
using Skynet.WebAdministracion.Constants;
using Skynet.BusinessLogic.BusinessComponents;
namespace Skynet.WebAdministracion.Views.ExamActivation
{
    public class ExamActivationPresenter : Infrastructure.Web.Views.Master.MasterPresenter<IExamActivationView>
    {
        [Dependency]
        public BusinessLogic.BusinessComponents.IBCCustomers BCCustomers { get; set; }
        [Dependency]
        public IBCCustomersQueries BCCustomersQueries { get; set; }

        [Dependency]
        public BusinessLogic.BusinessComponents.IBCExams BCExams { get; set; }

        [Dependency]
        public BusinessLogic.BusinessComponents.IBCExamQueries BCExamQueries { get; set; }

        [Dependency]
        public INavigationService NavigationService { get; set; }
        
        public override void OnViewInitialized()
        {
            this.View.Exams = this.BCExamQueries.SearchExams().ToList();
            this.View.Customers = this.BCCustomersQueries.FindCustomers().ToList();
        }
        public void ActivateExam(Guid CustomerId, Guid ExamId, short duration, DateTime validFrom , DateTime validTo)
        {
            this.BCExams.ActivateExam(CustomerId, ExamId, duration, validFrom, validTo);
            this.NavigationService.NavigateRoute(ViewNames.Support.Names.SucessMessage());
        }
    }
}